<?php
$this->pageTitle=Yii::app()->name . ' - Выдача рассрочки';
$this->breadcrumbs=array(
	'Карточка клиента'=>Yii::app()->createUrl('clients/view',array('id'=>$client->id)),
	'Выдача рассрочки'
);
?>

<fieldset>
    <legend>Выдача рассрочки</legend>
    <div id="add-credits-block" class="well">
		<?php $form=$this->beginWidget('bootstrap.widgets.TbActiveForm', array(
			'id'=>'add-credits-form',
			'type'=>'horizontal',
		)); ?>

		<div id="client-card-block">
			<dl class="dl-horizontal">
				<dt>Клиент</dt>
				<dd><?=$client->surname?> <?=$client->name?> <?=$client->patronymic?></dd>

				<dt><?=$client->getAttributeLabel('dob')?></dt>
				<dd><?=date('d.m.Y',strtotime($client->dob))?></dd>
			</dl>
		</div>

		<?php echo $form->textFieldRow($Credits,'sum', array('class'=>'input-block-level')); ?>
		<?php echo $form->textFieldRow($Credits,'duration', array('class'=>'input-block-level')); ?>
		<?php echo $form->textAreaRow($Credits, 'product_name', array('class'=>'input-block-level', 'rows'=>5)); ?>

        <div style="margin-top: 10px;">
			<?php $this->widget('bootstrap.widgets.TbButton', array(
				'buttonType'=>'submit',
				'type'=>'success',
				'label'=>'Оформить рассрочку',
				'loadingText'=>'Оформляется...',
				'htmlOptions'=>array('id'=>'add-credit-button')
			)); ?>
			<?php $this->widget('bootstrap.widgets.TbButton', array(
				'buttonType'=>'link',
				'url'=>Yii::app()->createUrl('clients/search'),
				'type'=>'danger',
				'label'=>'Отмена',
			)); ?>
        </div>

		<?php $this->endWidget(); ?>
    </div>
</fieldset>

<script type="text/javascript">
    $(document).ready(function(){
        $('#add-credit-button').click(function() {
            $(this).button('loading'); // call the loading function
        });
    });
</script>